home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / sourceaga / tunnel.s < prev    next >
Text File  |  1994-02-10  |  60KB  |  2,455 lines

  1.  
  2. ;rout            ;when this is off, the routine-file will be
  3.             ;assembled, on=testing
  4.             
  5. ;debug            ;when this is on, colors in the background will
  6.             ;show how much time the routine needs.
  7.  
  8. ;ntsctest        ;when this is on, the routineplayer is in ntsc-mode
  9.  
  10. ;ocs            ;off=AGA,on=OCS, testing not possible on OCS !
  11.  
  12. routinemode    equ    300    ;the routinemode !
  13.  
  14.  
  15. ; VideoTracker AGA developer source 25-12-93
  16. ; 24-bits colors, Super-HiRes, HAM8, maximum burstmode (64 pixels aligned)
  17. ; wich makes low-resolution overscan a bit ugly.
  18. ; no "interactive" support anymore, it's only used by Kick 1.3 users.
  19.  
  20. ; the first part of the source handles the things that are necessary to
  21. ; show the picture/copper and playing of the routine.
  22. ; the part between the "***" lines is the routine-source.
  23. ; at the bottom of the file, there are the necessary incbin-files who
  24. ; are needed to test the routine.
  25. ; these are saved with "save effect" in videotracker. they are raw
  26. ; data files which can be fonts,pictures,landscapes,vectorobjects
  27. ; etcetra.
  28. ; the incbin-files are put in the "variables" table, in the routine-
  29. ; player-handler
  30. ; the place where it's done can be found by searching for "!!!"
  31.  
  32.     opt    a+    ;devpac 3 optimize
  33.     opt    o+
  34.  
  35. vew_wid    equ    48
  36. vew_hgt    equ    290
  37. win_hgt    equ    117
  38. win_str    equ    $1a
  39.  
  40.         ifd    ocs
  41. pic_wid        equ    4        ;wide in bytes
  42. pic_hgt        equ    6        ;hoogte
  43. pic_dpt        equ    8        ;number planes
  44. pic_ani        equ    10        ;aantal effes (anim)
  45. pic_vew        equ    12        ;viewmode
  46. pic_cycstr    equ    14        ;cycle start (*4)
  47. pic_cycend    equ    15        ;cycle end (*4)
  48. pic_cycspd    equ    16        ;cycle speed (*4)
  49. pic_cycadd    equ    17        ;cycle add (*4)
  50. pic_palnum    equ    30        ;aantal kleuren
  51. pic_pal        equ    32        ;palette start
  52. pic_palsiz    equ    256*2        ;vaste palette size
  53. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  54.         endc
  55.         
  56.         ifnd    ocs
  57. pic_wid        equ    4        ;wide in bytes
  58. pic_hgt        equ    6        ;hoogte
  59. pic_dpt        equ    8        ;number planes
  60. pic_ani        equ    10        ;aantal effes (anim)
  61. pic_vew        equ    12        ;viewmode
  62. pic_cycstr    equ    14        ;cycle start (*8)
  63. pic_cycend    equ    15        ;cycle end (*8)
  64. pic_cycspd    equ    16        ;cycle speed (*8)
  65. pic_cycadd    equ    17        ;cycle add (*8)
  66. pic_widmod    equ    46        ;animation-width modulo
  67. pic_future    equ    50        ;free future space
  68. pic_palnum    equ    62        ;aantal kleuren
  69. pic_pal        equ    64        ;palette start
  70. pic_palsiz    equ    256*4        ;vaste palette size (longwords)
  71. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  72.         endc
  73.         
  74. var_len        equ    $300        ;lengte vartabel
  75.  
  76. var__GfxBase    equ    $000        ;graphics lib
  77. var_pic1    equ    $004        ;current picture
  78. var_anispd1    equ    $008        ;animspeed
  79. var_anitel1    equ    $00c        ;animcount
  80. var_cprbck    equ    $010        ;copperback
  81. var_bck        equ    $014        ;background
  82. var_pic2    equ    $018        ;current picture
  83. var_ntsc    equ    $01c        ;ntsc/pal frequence
  84. var_lnd        equ    $020        ;landscape
  85. var_anilop1    equ    $024
  86. var_rottrg    equ    $028        ;effect trigger
  87. var_txt1    equ    $040        ;text
  88. var_txt16    equ    15*4+var_txt1
  89. var_vec1    equ    $080        ;vectors
  90. var_vec16    equ    15*4+var_vec1
  91. var_fon1    equ    $0c0        ;fonts
  92. var_fon16    equ    15*4+var_fon1
  93. var_cols1    equ    $100        ;colorsets
  94. var_cols16    equ    15*4+var_cols1
  95. var_obj1    equ    $180        ;objects
  96. var_obj16    equ    15*4+var_obj1
  97.  
  98.     ifd    rout
  99.     ;videotracker routine-test
  100.  
  101.     incdir    "videotracker:include/"
  102.     include    "exec/types.i"
  103.     include    "graphics/gfxbase.i"
  104.     include    "lvo/graphics_lib.i"
  105.     incdir    'videotracker:effect/'
  106.  
  107.     SECTION    1,CODE_C
  108. tus
  109. ;    move.l    #rotpt1,curpic1        ;picture !!!
  110. ;    move.l    #rotpt1,curpal1        ;picture !!!
  111.     bsr    paltabres
  112.     
  113.     move.l    ($4).w,a6
  114.     sub.l    a1,a1
  115.     jsr    -$126(a6)        ;findtask
  116.     move.l    d0,curtsk
  117.     move.l    d0,a0
  118.     move.l    $b8(a0),tskpri
  119.  
  120.     lea    dosnam,a1        ;doslib openen
  121.     moveq.l    #0,d0
  122.     move.l    (4).w,a6
  123.     jsr    -408(a6)        ;openlib
  124.     move.l    d0,doslib
  125.  
  126.     bsr.s    label5            ;videotracker opstarten
  127.     
  128.     move.l    curtsk,a0
  129.     move.l    tskpri,$b8(a0)
  130.     move.l    ($4).w,a6
  131.     jsr    -$84(a6)        ;forbid
  132.  
  133.     move.l    doslib,a1
  134.     move.l    (4).w,a6
  135.     jsr    -414(a6)        ;closelib
  136.  
  137.     moveq.l    #0,d0
  138.     rts
  139.     
  140. label5
  141.     move.l    (4).w,a6        ;workbench gedoe
  142.  
  143.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  144.  
  145.     ifd    ntsctest
  146.     move.b    #60,ntscmode        ;60 hertz (ntsc)
  147.     endc
  148.  
  149.     cmp.b    #50,ntscmode        ;ntsc ?
  150.     beq.s    str.ntsc
  151.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  152. str.ntsc
  153.  
  154.     lea    cprjmp,a2        ;copjmp zetten !
  155.     move.l    #cprbck-8,d0
  156.     move.w    d0,6(a2)
  157.     swap    d0
  158.     move.w    d0,2(a2)
  159.  
  160.     lea    cprbck-8,a2        ;copstr zetten !
  161.     move.l    #cpr,d0
  162.     move.w    d0,6(a2)
  163.     swap    d0
  164.     move.w    d0,2(a2)
  165.  
  166.     bsr    cprsprrem        ;sprites legen
  167.  
  168.     lea    gfxnam,a1        ;graphics lib openen
  169.     move.l    (4).w,a6
  170.     jsr    -408(a6)        ;openlib
  171.     move.l    d0,a6
  172.     move.l    d0,gfxlib
  173.     move.l    38(a6),oldcprlist
  174.  
  175.     bset    #1,$bfe001
  176.     bsr    copbuf            ;copper vullen
  177.  
  178.     bsr    sysoff
  179.  
  180. gadrun
  181.     btst    #6,($bfe001).l
  182.     bne    gadrun
  183.  
  184. scrend
  185. scrend.play
  186.     bsr    syson
  187.  
  188.     move.l    gfxlib,a1
  189.     move.l    (4).w,a6
  190.     jsr    -414(a6)        ;closelib
  191.  
  192. scrend.qb
  193.     moveq.l    #0,d0    
  194.     rts
  195.     
  196.     ;vertical blank interrupt, no blits.
  197.     ;handles counters,interlace,sprite
  198.     ;level 3
  199.  
  200. intvb
  201.     bra.s    intvb.cnt
  202.     dc.l    'VIDU'
  203.     dc.l    'LOOP'
  204. intvb.cnt
  205.     movem.l    d0-d7/a0-a6,-(sp)
  206.     lea    ($dff000).l,a6
  207.  
  208.     move.w    $01e(a6),d0
  209.     btst    #5,d0            ;vblank ?
  210.     bne.s    intvb.vb
  211.  
  212.     bra.s    intcop.end
  213.  
  214. intvb.vb
  215.     bsr    grap
  216.     bsr    palctr            ;palette zetten
  217.     bsr.s    copbuf            ;copper vullen
  218.     
  219. intvb.end
  220.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  221.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  222.     rte
  223.  
  224. intcop.end
  225.     movem.l    (sp)+,d0-d7/a0-a6
  226.     move.l    intvbold,-(sp)
  227.     rts
  228.  
  229.     ;transmission buffer empty routine, BLIT !
  230.     ;handles routines,animations
  231.     
  232. inttbe                    ;tbe interrupt
  233.     movem.l    d0-d7/a0-a6,-(sp)
  234.     lea    ($dff000).l,a6
  235.  
  236.     move.w    $01e(a6),d0
  237.     btst    #0,d0            ;no tbe ?
  238.     beq.s    intdskblk
  239.  
  240.  
  241.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  242.     beq.s    inttbe.cop
  243.     btst    #2,($dff016).l
  244.     beq.s    inttbe.cop
  245.  
  246.     ifd    debug
  247.     move.w    #$700,$dff180
  248.     endc
  249.     
  250.     bsr    rotply            ;routineplayer BLIT !
  251.     bsr.s    copbuf            ;copper vullen
  252.  
  253.     ifd    debug
  254.     move.w    #$070,$dff180
  255.     endc
  256.     
  257. inttbe.cop
  258.  
  259. inttbe.end
  260.     move.w    #$0001,$09c(a6)
  261.     movem.l    (sp)+,d0-d7/a0-a6
  262.     rte
  263.  
  264. intdskblk
  265.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  266.     movem.l    (sp)+,d0-d7/a0-a6
  267.     move.l    inttbeold,-(sp)
  268.     rts
  269.  
  270.  
  271.     ;moves the copperbuffer to the copperlist
  272.     ;sort of double buffering
  273.     
  274. copbuf
  275.     movem.l    d0-d7/a0-a6,-(sp)
  276.  
  277.     lea    ($dff000).l,a6
  278.  
  279. copbuf.novb                ;copperchange overslaan
  280.     moveq.l    #0,d0
  281.     move.b    $005(a6),d0
  282.     lsl.w    #8,d0
  283.     moveq.l    #0,d1
  284.     move.b    $006(a6),d1
  285.     add.w    d1,d0
  286.  
  287.     cmp.w    #$4,d0            ;lower limit, all stations 100%
  288.     blt    copbuf.novb
  289.  
  290.     cmp.b    #50,ntscmode
  291.     beq.s    copbuf.pal
  292.     cmp.w    #$133-72-8,d0        ;ntsc grens
  293.     bge    copbuf.novb
  294.     bra.s    copbuf.cont
  295. copbuf.pal
  296.     cmp.w    #$133-8,d0        ;pal grens
  297.     bge    copbuf.novb
  298. copbuf.cont
  299.  
  300.     lea    gra.s,a0        ;buffer copieren
  301.     lea    cprbuf,a1
  302. copbuf_aga                ;AGA stuff :)
  303.     move.l    #(gra.ql)/4-1,d0
  304. copbuf.a
  305.     move.w    2(a0),2(a1)
  306.     add.l    #4,a0
  307.     add.l    #4,a1
  308.     dbra    d0,copbuf.a
  309.  
  310. copbuf.end
  311.     movem.l    (sp)+,d0-d7/a0-a6
  312.     rts
  313.  
  314.     ;goes back to the workbench
  315.     
  316. syson
  317.     movem.l    d0-d7/a0-a6,-(sp)
  318.  
  319.     move.w    #$0001,$dff09a        ;tbeint uit
  320.     move.l    intvbold,($6c).w
  321.     move.l    inttbeold,($64).w
  322.  
  323.     move.l    4,a6
  324.     jsr    -138(a6)        ;permit
  325.  
  326.     move.l    gfxlib,a6
  327.     jsr    -462(a6)        ;disownblitter
  328.  
  329.     move.l    wbview,a1
  330.     move.l    gfxlib,a6
  331.     jsr    _LVOLoadView(a6)     ; Fix view
  332.     jsr    _LVOWaitTOF(a6)
  333.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  334.  
  335. syson.ras
  336.     cmp.b    #$c0,$dff006        ;prevent copperjump
  337.     bne    syson.ras
  338.  
  339.     move.l    gfxlib,a6
  340.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  341.  
  342.     movem.l    (sp)+,d0-d7/a0-a6
  343.     rts
  344.     
  345.     ;goes back to the gadgetscreen
  346.     
  347. sysoff
  348.     movem.l    d0-d7/a0-a6,-(sp)
  349.      
  350.     move.l    gfxlib,a6
  351.     move.l    gb_ActiView(a6),wbview    ;current view
  352.     sub.l    a1,a1            ; clear a1
  353.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  354.     jsr    _LVOWaitTOF(a6)     ; Wait once
  355.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  356.  
  357.     move.l    gfxlib,a6
  358.     jsr    -456(a6)        ;ownblitter
  359.  
  360.     move.l    4,a6
  361.     jsr    -132(a6)        ;forbid
  362.         
  363.     move.l    ($6c).w,intvbold
  364.     move.l    #intvb,($6c).w
  365.     move.l    ($64).w,inttbeold
  366.     move.l    #inttbe,($64).w
  367.     move.w    #$8001,$dff09a        ;tbeint aan
  368.     bsr    gracpr            ;reset copper
  369.     bsr    copbuf            ;copy copper
  370.     move.l    #cpr,$dff080
  371.  
  372.     movem.l    (sp)+,d0-d7/a0-a6
  373.     rts
  374.     
  375. cprsprrem
  376.     movem.l    d0-d7/a0-a6,-(sp)
  377.     lea    cprspr,a0
  378.     move.l    #sprdat,d0
  379.     move.w    #7,d1
  380. cprsprrem.a
  381.     move.w    d0,3*2(a0)
  382.     swap    d0
  383.     move.w    d0,1*2(a0)
  384.     swap    d0
  385.     add.l    #8,a0
  386.     dbra    d1,cprsprrem.a
  387.     movem.l    (sp)+,d0-d7/a0-a6
  388.     rts
  389.  
  390. varset                    ;variablen neerzetten
  391.     movem.l    d0-d7/a0-a6,-(sp)
  392.     move.l    #var,a0
  393.  
  394.     move.l    #cprbck,var_cprbck(a0)
  395.     move.l    gfxlib,var__GfxBase(a0)
  396.     move.b    ntscmode,var_ntsc(a0)
  397.  
  398.     move.l    curpic1,var_pic1(a0)    ;variabel
  399.     move.l    curpic2,var_pic2(a0)    ;variabel
  400.     move.w    anispd1,var_anispd1(a0)
  401.     move.w    anitel1,var_anitel1(a0)
  402.     move.b    anilop1,var_an